<?php 
// wymagane w layout
//echo $this->Section->main();
?>

<div class="content-homenpage">
	<?php echo $this->element('carousel',array('plugin' => 'store',
		'items'=>$this->Store->products(4,array('limit'=>12))
		,'group_id'=>4
		,'params'=>array('width'=>190,'height'=>190,'padding'=>10,'margin'=>10,'border'=>1)
		));?>	
	<div class="clr"></div>	
</div>	
		
<div class="clr"></div>
	<div class="content-homenpage">
		<div id="left-column">
			<?php echo $this->element('left_column')?>		
		</div>
		
		<div class="right-store-column search-bg">
			<?php echo $this->element('search_more',array('plugin'=>'store'))?>
		</div>
		
		<div class="right-store-column">	
		

			<div class="comments">
				<table class="blog">
					<tr>
						<td>
						<table width="100%" cellpadding="10" cellspacing="0" class="post">
							<tr>
								<td><?php echo $this->Html->link('<h2>'.$post['Post']['name'].'</h2>', array('action' => 'view', $post['Post']['id']),array('escape'=>false)); ?>
									&nbsp;
								</td>
							</tr>
							<tr>
								<td class="content">
								<?php echo $post['Post']['content'];?>&nbsp;
								</td>
							</tr>
							<tr>
								<td>
									<table class="corners" bgcolor="#bbbbbb" cellpadding="4" width="100%" cellspacing="4">
										<tr>
											<td valign="middle" width="12%">
												<?php echo __('Comments:',true)?>
											</td>
											<td valign="middle" align="center" width="3%">
												<?php echo count($post['Comment'])?>
												
											</td>
											<td valign="middle" width="45%" align="right"><?php echo __('Added:',true)?>&nbsp;</td>
											<td align="right" valign="middle" width="40%">
												<?php echo $post['Post']['modified']; ?>&nbsp;
											</td>								
										</tr>
									</table>
								</td>
							</tr>
						</table>
						</td>
					</tr>
				</table>
				<?php echo $this->Form->create('Comment');?>
					<fieldset>
				 		<legend><?php __('Add Comment'); ?></legend>
					<?php
						echo $this->Form->input('name');
						echo (isset($post['Post']['id']) && is_numeric($post['Post']['id'])) ? $this->Form->hidden('post_id',array('value'=>$post['Post']['id'])) : $this->Form->input('post_id') ;
						echo $this->Form->input('content');
						if($session->check('Auth.User.id') && $this->Session->read('Auth.User.group') == 'admin' || $session->check('Auth.User.id') && $this->Session->read('Auth.User.group') == 'manag')
						echo $this->Form->input('status');
					?>
					</fieldset>
				<?php echo $this->Form->end(__('Submit', true));?>
				</div>
				<div class="comments">
					<table class="blog">
						<?php foreach ($post['Comment'] as $coment): ?>
						<?php if($coment['status']){?>
						<tr>
							<td>
							<table width="100%" cellpadding="10" cellspacing="0" class="post">
								<tr>
									<td class="content">
									<?php echo $coment['content']?>&nbsp;</td>
								</tr>
								<tr>
									<td>
										<table class="corners" bgcolor="#bbbbbb" cellpadding="4" width="100%" cellspacing="4">
											<tr>
												<td valign="middle" width="15%">
													<?php echo __('First Name:',true)?>
												</td>
												<td valign="middle" align="left" width="30%">
													<?php echo $coment['name']?>									
												</td>
												<td valign="middle" width="15%" align="right">
													<?php echo __('Added:',true)?>
												</td>
												<td valign="middle" width="40%" align="left"><?php echo $coment['added']?>&nbsp;</td>
							
											</tr>
										</table>
									</td>
								</tr>
							</table>
							</td>
						</tr>
						<?php }?>
						<?php endforeach; ?>
					</table>
				</div>
		
		
		</div>
	</div>
</div>